<template>
  <div class="app-container">
    <div class="head-container"></div>
    <div style="margin-bottom: 10px;">
      <el-form size="small" label-width="70px">
        <el-row :gutter="10">
          <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
              <el-form-item label="业务日期">
                <div class="flex flex-row">
                  <el-date-picker v-model="query.startDate" align="right" unlink-panels class="fl1" format="yyyy - MM - dd " value-format="yyyy-MM-dd" default-value range-separator="" placeholder="开始日期"/>
                  <el-date-picker v-model="query.endDate" align="right" unlink-panels class="fl1" format="yyyy - MM - dd " value-format="yyyy-MM-dd" default-value range-separator="" placeholder="结束日期"/>
                </div>
              </el-form-item>
            </el-col>
            <el-row style="display: flex;justify-content: end;">
          <el-button
            size="mini"
            type="primary"
            @click="crud.toQuery"
            >查询</el-button>
        <el-button
            size="mini"
            type="primary"
            @click="crud.resetQuery"
            style="margin-right:5px">重置</el-button> 
        </el-row>
        </el-row>
      </el-form>
    </div>
    <!--表格渲染-->
    <el-table
      ref="table"
      border
      stripe
      v-loading="crud.loading"
      :data="crud.data"
      size="small"
      style="width: 100%"
      height="700" @row-click="crud.selectRow">
      <el-table-column type="selection" width="55" />
      <el-table-column type="index" width="55" label="序号" />
     <el-table-column label="业务日期" prop="busDate"/>
     <el-table-column prop="sourceType" label="单据类型">
          <template slot-scope="scope">
          {{ dict.label.dict_CustomerStock_order_type[scope.row.sourceType] }}
        </template>
      </el-table-column>
     <el-table-column label="单据编码" prop="sourceCode"/>
     <el-table-column label="商品编码" prop="goodsCode"/>
      <el-table-column label="商品名称" prop="goodsName"/>
      <el-table-column label="条形码" prop="barcode"/>
      <el-table-column label="期初辅数量" prop="mergeBeginGoodsCount"/>
      <el-table-column label="期初数量" prop="beginGoodsCount"/>
      <el-table-column label="入库辅数量" prop="mergeInGoodsCount"/>
      <el-table-column label="入库数量" prop="inGoodsCount"/>
      <el-table-column label="盘点辅数量" prop="mergeCheckGoodsCount"/>
      <el-table-column label="盘点数量" prop="checkGoodsCount"/>
      <el-table-column label="结余辅数量" prop="mergeEndGoodsCount"/>
      <el-table-column label="结余数量" prop="endGoodsCount"/>
      <el-table-column label="销售辅数量" prop="mergeSaleGoodsCount"/>
      <el-table-column label="销售数量" prop="saleGoodsCount"/>
    </el-table>
    <!--分页组件-->
    <pagination />
  </div>
</template>

<script>
import CRUD, { presenter, header, form, crud } from "@crud/crud";
import pagination from "@crud/Pagination";
// crud交由presenter持有
const defaultCrud = CRUD({
  title: "客户库存统计明细",
  url: "/api/customerStock/detail",
  sort: "id,desc",
  params() {
    const href = location.href.split('/')
    return {
      orderId: href[href.length - 1] == 'add' ? 0 : href[href.length - 1]
    }
  },
});
const defaultForm = {};
export default {
  name: "",
  components: {
    pagination,
  },
  dicts: ['dict_CustomerStock_order_type',],
  mixins: [
    presenter(defaultCrud),
    header(),
    form(defaultForm),
    crud(),
  ],
  mounted() {},
  created() {},
  data() {
    return {
      
    };
  },
  watch: {},
  methods: {
      // 获取数据前设置好接口地址
    [CRUD.HOOK.beforeRefresh]() {
      return true;
    }, // 新增与编辑前做的操作
    [CRUD.HOOK.afterToCU](crud, form) {},
     
  },
};
</script>

<style scoped>
.table-img {
  display: inline-block;
  text-align: center;
  background: #ccc;
  color: #fff;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  vertical-align: middle;
  width: 32px;
  height: 32px;
  line-height: 32px;
}
.flex {
  display: flex;
  justify-content: center;
}
::v-deep .el-table--border th.el-table__cell {
  border-bottom: 1px solid #000;
}
</style>
